<?php


namespace app\common\model;


use think\Model;

class UserTdLevel extends Model
{
    protected $pk = "level_id";
    // 定义时间戳字段名
    protected $createTime = 'add_time';
    //修改format类型
    protected $dateFormat = "Y-m-d H:i:s";
    protected $type=[
        'yeji'     =>  'float',
        'jl_bl'    =>  'float',
        'pj_bl'    =>  'float',
        'xq_yeji'  =>  'float',
    ];
    public function getPkAttr() {
        return $this->pk;
    }
    //获取升级条件
    public function getTiaoJianTextAttr($value,$data) {
        if ($this->xq_yeji>0 && $data['num']>0 && $data['num_level_id']>0){
            $level_name=$this->where('level_id',$data['num_level_id'])->value('name');
            return "小区业绩{$this->xq_yeji}并培养{$data['num']}名{$level_name}";
        }
        return '---';
    }
}